package com.gyul.findmystock.entity;

import java.io.Serializable;

import com.gyul.findmystock.util.Utils;

public class CompanyEntity implements Comparable<CompanyEntity> , Serializable {
	private static final long serialVersionUID = -3737106129454110300L;
	
	public String symbol;
	public String name;
	public int lastDate;
	public int lastPrice;
	
	
	public CompanyEntity() {
		symbol = name = null;
		lastDate = lastPrice = 0;
	}
	
	public CompanyEntity(String symbol, String name) {
		this.symbol = symbol;
		this.name = name;		
		lastDate = lastPrice = 0;
	}
	
	public CompanyEntity(String symbol, String name, int lastDate, int lastPrice) {
		this.symbol = symbol;
		this.name = name;		
		this.lastDate = lastDate;
		this.lastPrice = lastPrice;
	}
	
	@Override
	public int compareTo(CompanyEntity company) {
		return symbol.compareTo(company.symbol);		
	}	
	
	@Override
	public String toString() {		
		return name + " - " + symbol + "\n" + Utils.getDateFormat(lastDate) + " : " + Utils.getMoneyFormat(lastPrice);
	}
}
